import http from '@/utils/http'
const qs = require("qs");
import { configStore } from "@/store/config";
const configUserStore = configStore();
import {formatHgaTime, utf16to8, replaceTeamName, formatTime, formatRECount, formatHttpUrl} from "@/utils/utils";

let domainURL = formatHttpUrl(configUserStore.setting.u1368_url);
// domainURL = "https://www.u1368.com"


/// 登录
export const toU1368Login = async function (data) {
	let res = await http.post(domainURL + '/membersite-api/api/member/authenticate', qs.stringify(data))
	if(res['success']) {
		return {
			"state": 1,
			'message': "login suc"
		}
	}
	return {
		"state": 0,
		'message': "login error"
	}
};

/// 获取余额
export const getU1368UserInfo = async function() {
	let res = await http.get(domainURL + "/membersite-api/api/member/info?_=" + (+new Date()));
	if(res['name']) {
		return {
			"state": 1,
			"data": res,
			"message": "getUserInfo suc"
		}
	}
	return {
		"state": 0,
		"message": "getUserInfo error"
	}
}